#include<stdio.h>
#include<string.h>

int main(){
    //会默认打开stdin输入流，stdout输出流，stderror错误流
    const char *msg = "hello fwrite\n";
    fwrite(msg, strlen(msg), 1, stdout);
    printf("hello printf\n");
    fprintf(stdout, "hello fprintf\n");

    //FILE *fp = fopen("myfile", "r");
    ////FILE *fp = fopen("myfile", "w");//‘w’每次写入，会先清除，在写入
    ////FILE *fp = fopen("myfile", "a");//若想追加写入，则使用a
    //if(!fp){    
    //    printf( "fopen error!\n");
    //    return 1 ;
    //}           
    //            
    //char buf[1024];
    //const char  *msg = "hello\n";
    //while(1){
    //   size_t s = fread(buf, 1, strlen(msg), fp);
    //   //读取成功，返回读取字节大小
    //   if(s > 0){
    //       buf[s] = 0;
    //       printf("%s", buf);
    //   }
    //   if(feof(fp)){
    //    break;
    //   }
    //}           
    //
    ////char buf[1024];
    ////const char  *msg = "hello\n";
    ////int count =  5;
    ////while(count --){
    ////    fwrite( msg, strlen(msg), 1, fp);
    ////}           
    //            
    //fclose(fp); 
    return 0;   
}               
                
                
                
